/********************************************************************

Write Date: 2011/07/29
Author: Deng Nianchen
>>>> Add class FileReader

*********************************************************************/
#ifndef FILEREADER_H
#define FILEREADER_H
#include "StreamReader.hpp"
#include <fstream>


_OOPUTILS_BEGIN



/**************************************************************************************************
 * <summary> Purpose: Inherited from StreamReader, used to read data from file.
 *					 Often be combined with other StreamReaders such as
 *					 BufferReader and TextReader to gain additional abilities.
 * 					 Thread-Safe: the class is not thread-safe. </summary>
 * 
 * <remarks>  Deng Nianchen, 2011/07/29. </remarks>
 **************************************************************************************************/

class FileReader : public StreamReader
{
public:

	FileReader (const OOPString & filename);

	~FileReader ();

	virtual void resetPos ();

	virtual OOPPtr< ByteArray > read (size_t count);

	virtual void skip (size_t count);

	virtual size_t getPos ();

	virtual bool isEof ();

	void open (const OOPString & filename);

	void close ();

	virtual void setPos (size_t pos);

private:

	std::ifstream _fin;
};



_OOPUTILS_END
#endif